from gupiao.code_info import generate_info_reverse

dict = generate_info_reverse('output-2021-09-05.csv')

gainian_dict = {}
with open('gainian_1.txt', encoding='utf-8') as f:
    for line in f:
        clean_line = line.strip()
        # 商品及对应的股票
        shanping = clean_line[:clean_line.find('：')]
        gupiao = clean_line[clean_line.find('：')+1:]
        # print(shanping, gupiao)
        spilt_gupiao = gupiao.split('、')
        # print(shanping, end=' ')
        code_list = []
        for i in spilt_gupiao:
            code_list.append(dict[i])
        gainian_dict[shanping] = code_list
print(gainian_dict)